﻿using DevExpress.XtraEditors;
using SWF = System.Windows.Forms;

namespace Mota.XMLControls
{
    /// <summary>
    /// Represent SplitterPanel and based on DX SplitGroupPanel
    /// </summary>
    public class DXGuiSplitterPanel:GuiSplitterPanel
    {
        /// <summary>
        /// Assign to visualControl Panel1 or Panel2 depending on count of parent child count
        /// </summary>
        /// <param name="parent">Parent splitter</param>
        public DXGuiSplitterPanel(GuiSplitter parent)
            : base(parent)
        {
            if (parent.GetCount() > 0)
            {
                visualControl = (parent.visualControl as SplitContainerControl).Panel2;
            }
            else
            {
                visualControl = (parent.visualControl as SplitContainerControl).Panel1;
            }

        }
        /// <summary>
        /// Add visual controls to current panel
        /// </summary>
        /// <param name="guiControl">child control</param>
        public override void Add(GuiControl guiControl)
        {
            base.Add(guiControl);
            (visualControl as SplitGroupPanel).Controls.Add((guiControl.visualControl as SWF.Control));
        }

        /// <summary>
        /// GET|SET SplitGroupPanel Text property
        /// </summary>
        public override string Text
        {
            get
            {
                return (visualControl as SplitGroupPanel).Text;
            }
            set
            {
                (visualControl as SplitGroupPanel).Text = value;
            }
        }
        /// <summary>
        /// dummy object 
        /// </summary>
        public override object Binding
        {
            get
            {
                return null;
            }
            set
            {
            }
        }


        public override void SetValue(object valueBinding)
        {
            throw new System.NotImplementedException();
        }

        public override object GetValue()
        {
            throw new System.NotImplementedException("Splitte dont have value");
        }
    }
}
